# -*- coding:utf-8 -*-
import csv
fname = 'reg.csv'

def redcsv(search):
# 读取操作
    try:
        with open(fname,'rb') as csvfile:
            reader = csv.DictReader(csvfile)
            for row in reader:
                if row['name']==search:
                    return row
            row['addr']=0
            return row
    except:
        row['addr']=0
        return row